import { reqSelectDetailInfo } from '@/api'
const state = {
  selectInfo: {},
}
const mutations = {
  //储存订单交易页信息
  SAVE_SELECT_INFO(state, payload) {
    state.selectInfo = payload
  },
}
const actions = {
  //获取订单交易页信息
  async getSelectInfo({ commit }) {
    const result = await reqSelectDetailInfo()
    if (result.code === 200) {
      commit('SAVE_SELECT_INFO', result.data)
    } else {
      console.log(result.message)
    }
  },
}
const getters = {
  adviceNum(state) {
    return state.selectInfo.adviceInfo.adviceNum
  },
  watchNum(state) {
    return state.selectInfo.adviceInfo.watchNum
  },
  adviceData(state) {
    return state.selectInfo.adviceInfo.adviceData || []
  },
}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
}
